import java.util.Scanner;
class book1 {
    private String name;
    private String author;
    String press;
    private double price;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getPress() {
        return press;
    }

    public void setPress(String press) {
        this.press = press;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        if (price > 10) {
            this.price = price;
        } else {
            System.out.println("价格无效，必须大于10元");
            this.price = 10;
        }
    }

    public book1() {
        name = "java基础案例教程";
        author = "黑马程序员";
        press = "人民邮电出版社";
        price = 58.9;
    }

    public book1(String name, String author, String press, double price) {
        this.name = name;
        this.author = author;
        this.press = press;
        this.price = price;
    }

    void imformation() {
        System.out.println("书名：" + this.getName());
        System.out.println("作者：" + this.getAuthor());
        System.out.println("出版社：" + this.getPress());
        System.out.println("价格：" + this.getPrice() + "元");
    }
}
    public class shu {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String t,a,ps;
        double pc;
        System.out.println("第一本书：");
        book1 b = new book1();
        b.imformation();
        System.out.println("第二本书：");
        System.out.print("请输入书本的书名：");
        t = sc.nextLine();
        System.out.print("请输入书本的作者：");
        a = sc.nextLine();
        System.out.print("请输入书本的出版社：");
        ps = sc.nextLine();
        System.out.print("请输入书本的价格：");
        pc = sc.nextDouble();
        book1 b2 = new book1(t,a,ps,pc);
        b2.imformation();
    }
    }


